<script lang="ts" setup>
import type { EdubaseSemesterApi } from '#/api/edu/base/setting/semester';

import { ref } from 'vue';

import { useVbenDrawer } from '@vben/common-ui';

import SemesterWeek from '../semesterWeek/index.vue';

const formData = ref<EdubaseSemesterApi.Semester>();

const [Drawer, drawerApi] = useVbenDrawer({
  async onOpenChange(isOpen: boolean) {
    if (!isOpen) {
      formData.value = undefined;
      return;
    }
    const data = drawerApi.getData<EdubaseSemesterApi.Semester>();
    formData.value = data;
  },
});
</script>

<template>
  <Drawer title="查看周数据" class="w-[80%]">
    <SemesterWeek
      v-if="formData?.id"
      :semester-id="formData?.id"
      class="mx-4"
    />
  </Drawer>
</template>
